{extend name="layout/main" /}

{block name="header"}

{/block}

{block name="content"}
<!--<link rel="stylesheet" href="http://cdn.staticfile.org/webuploader/0.1.5/webuploader.css">-->
<!--<script type="text/javascript" src='http://cdn.staticfile.org/webuploader/0.1.5/webuploader.min.js'></script>-->
<style type="text/css">
    /*body{*/
    /*overflow-x:hidden;*/
    /*overflow-y: auto;*/
    /*width:100%;*/
    /*}*/
    /*.table{*/
    /*display: block;*/
    /*overflow-y: hidden;*/
    /*overflow-x: auto;*/
    /*}*/
    /*.form-control{*/
    /*width: auto;*/
    /*}*/

</style>


<section class="panel">
    <header class="panel-heading">
        <h4>房间配置管理</h4>
    </header>
    <div class="panel-body" style="padding-bottom: 50px;width:100%;height: auto;">
        <table class="table table-bordered table-striped no-margin" style="overflow-x: auto">
            <thead>
            <tr>
                <th class="text-center">序号</th>
                <th class="text-center">名称</th>
                <th class="text-center">类型</th>
                <!--<th class="text-center">准入额</th>-->
                <th class="text-center">佣金提成</th>
                <th class="text-center">操作</th>
            </tr>
            </thead>
            <tbody>
            {foreach $config as $key=>$config}
            <tr>
                <td class="text-center" style="vertical-align: middle; ">{$key+1}</td>
                <td class="text-center" style="vertical-align: middle; ">
                <input type="text" disabled id="_name_{$config['id']}" style="text-align: center" class="form-control"
                       value="{$config['name']}">
                </td>
                <td class="text-center" style="vertical-align: middle; ">
                    <input type="number" id="_size_{$config['id']}" style="text-align: center" class="form-control"
                           value="{$config['size']}">
                </td>
               <!-- <td class="text-center" style="vertical-align: middle; ">
                <input type="number" id="_money_{$config['id']}" style="text-align: center" class="form-control"
                       value="{$config['money']}">
                </td>-->
                <td class="text-center" style="vertical-align: middle; ">
                    <input type="number" id="_percentage_{$config['id']}" style="text-align: center" class="form-control"
                           value="{$config['percentage']}">
                </td>
                <td class="text-center" style="vertical-align: middle; ">
                    <a onclick="updateConfigCopy(this)"
                       data-zhitui="{$config['name']}"
                       data-money="{$config['size']}"
                       data-num1="{$config['money']}"
                       data-num2="{$config['percentage']}"
                       id-data="{$config['id']}" class="btn btn-xs btn-primary">确认修改</a>
                </td>

            </tr>
            <!-- {/if} -->
            {/foreach}
            </tbody>
        </table>
    </div>
</section>


{/block}

{block name="footer"}

<script>

    function updateConfigCopy(e) {
        var id = $(e).attr('id-data');

        var name = $('#_name_' +id).val();
        var size = $('#_size_' +id).val();
        var money = $('#_money_' +id).val();
        var percentage = $('#_percentage_' +id).val();



        $.post("{:url('configSave')}", {
            id: id,
            name: name,
            size: size,
            money: money,
            percentage: percentage,


        }, function (data) {
            if (data.code == 1) {
                main.waringAlert(data.message);
            } else {
                main.waringAlert(data.message);
                window.location.reload();
            }
        }, 'json')
    }





</script>


</script>
{/block}
